import os
from time import sleep
from selenium import webdriver

# 打开浏览驱动器
driver = webdriver.Chrome()
driver.implicitly_wait(3)

# 将浏览器最大化
driver.maximize_window()

# 获取当前目录的selen.html文件
file_path = os.path.join('file:///', os.getcwd(), "selenium.html")
driver.get(file_path)
# 上传文件
file_upload = driver.find_element_by_css_selector('[name="upload"]')
file_upload.send_keys(file_path)
sleep(2)
input = driver.find_element_by_css_selector('[type="submit"]')
input.click()

sleep(2)
# 关闭浏览器
driver.quit()

